/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:host {
    --spectrum-toast-font-weight: var(--spectrum-regular-font-weight);
    --spectrum-toast-font-size: var(--spectrum-font-size-100);
    --spectrum-toast-corner-radius: var(--spectrum-corner-radius-100);
    --spectrum-toast-block-size: var(--spectrum-toast-height);
    --spectrum-toast-max-inline-size: var(--spectrum-toast-maximum-width);
    --spectrum-toast-border-width: var(--spectrum-border-width-100);
    --spectrum-toast-line-height: var(--spectrum-line-height-100);
    --spectrum-toast-line-height-cjk: var(--spectrum-cjk-line-height-100);
    --spectrum-toast-spacing-icon-to-text: var(--spectrum-text-to-visual-100);
    --spectrum-toast-spacing-start-edge-to-text-and-icon: var(--spectrum-spacing-300);
    --spectrum-toast-spacing-text-and-action-button-to-divider: var(--spectrum-spacing-300);
    --spectrum-toast-spacing-top-edge-to-divider: var(--spectrum-spacing-100);
    --spectrum-toast-spacing-bottom-edge-to-divider: var(--spectrum-spacing-100);
    --spectrum-toast-spacing-top-edge-to-icon: var(--spectrum-toast-top-to-workflow-icon);
    --spectrum-toast-spacing-text-to-action-button-horizontal: var(--spectrum-spacing-300);
    --spectrum-toast-spacing-close-button: var(--spectrum-spacing-100);
    --spectrum-toast-spacing-block-start: var(--spectrum-spacing-100);
    --spectrum-toast-spacing-block-end: var(--spectrum-spacing-100);
    --spectrum-toast-spacing-top-edge-to-text: var(--spectrum-toast-top-to-text);
    --spectrum-toast-spacing-bottom-edge-to-text: var(--spectrum-toast-bottom-to-text);
    --spectrum-toast-negative-background-color-default: var(--spectrum-negative-background-color-default);
    --spectrum-toast-positive-background-color-default: var(--spectrum-positive-background-color-default);
    --spectrum-toast-informative-background-color-default: var(--spectrum-informative-background-color-default);
    --spectrum-toast-text-and-icon-color: var(--spectrum-white);
}

@media (forced-colors: active) {
    :host {
        --highcontrast-toast-border-color: ButtonText;
        border: var(--mod-toast-border-width, var(--spectrum-toast-border-width)) solid var(--highcontrast-toast-border-color, transparent);
    }
}

:host {
    box-sizing: border-box;
    min-block-size: var(--mod-toast-block-size, var(--spectrum-toast-block-size));
    max-inline-size: var(--mod-toast-max-inline-size, var(--spectrum-toast-max-inline-size));
    border-radius: var(--mod-toast-corner-radius, var(--spectrum-toast-corner-radius));
    font-size: var(--mod-toast-font-size, var(--spectrum-toast-font-size));
    font-weight: var(--mod-toast-font-weight, var(--spectrum-toast-font-weight));
    -webkit-font-smoothing: antialiased;
    background-color: var(--mod-toast-background-color-default, var(--spectrum-toast-background-color-default));
    color: var(--mod-toast-background-color-default, var(--spectrum-toast-background-color-default));
    overflow-wrap: anywhere;
    flex-direction: row;
    align-items: stretch;
    padding-inline-start: var(--mod-toast-spacing-start-edge-to-text-and-icon, var(--spectrum-toast-spacing-start-edge-to-text-and-icon));
    display: inline-flex;
}

:host([variant="negative"]) {
    background-color: var(--mod-toast-negative-background-color-default, var(--spectrum-toast-negative-background-color-default));
}

:host([variant="negative"]),
:host([variant="negative"]) .closeButton:focus-visible:not(:active) {
    color: var(--mod-toast-negative-background-color-default, var(--spectrum-toast-negative-background-color-default));
}

:host([variant="info"]) {
    background-color: var(--mod-toast-informative-background-color-default, var(--spectrum-toast-informative-background-color-default));
}

:host([variant="info"]),
:host([variant="info"]) .closeButton:focus-visible:not(:active) {
    color: var(--mod-toast-informative-background-color-default, var(--spectrum-toast-informative-background-color-default));
}

:host([variant="positive"]) {
    background-color: var(--mod-toast-positive-background-color-default, var(--spectrum-toast-positive-background-color-default));
}

:host([variant="positive"]),
:host([variant="positive"]) .closeButton:focus-visible:not(:active) {
    color: var(--mod-toast-positive-background-color-default, var(--spectrum-toast-positive-background-color-default));
}

.type {
    flex-grow: 0;
    flex-shrink: 0;
    margin-block-start: var(--mod-toast-spacing-top-edge-to-icon, var(--spectrum-toast-spacing-top-edge-to-icon));
    margin-inline-start: 0;
    margin-inline-end: var(--mod-toast-spacing-icon-to-text, var(--spectrum-toast-spacing-icon-to-text));
}

.content,
.type {
    color: var(--mod-toast-text-and-icon-color, var(--spectrum-toast-text-and-icon-color));
}

.content {
    box-sizing: border-box;
    line-height: var(--mod-toast-line-height, var(--spectrum-toast-line-height));
    text-align: start;
    flex: auto;
    padding-block-start: calc(var(--mod-toast-spacing-top-edge-to-text, var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start, var(--spectrum-toast-spacing-block-start)));
    padding-block-end: calc(var(--mod-toast-spacing-bottom-edge-to-text, var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end, var(--spectrum-toast-spacing-block-end)));
    padding-inline-start: 0;
    padding-inline-end: var(--mod-toast-spacing-text-to-action-button-horizontal, var(--spectrum-toast-spacing-text-to-action-button-horizontal));
    display: inline-block;
}

.content:lang(ja),
.content:lang(ko),
.content:lang(zh) {
    line-height: var(--mod-toast-line-height-cjk, var(--spectrum-toast-line-height-cjk));
}

.buttons {
    border-inline-start-color: var(--mod-toast-divider-color, var(--spectrum-toast-divider-color));
    flex: none;
    align-items: flex-start;
    margin-block-start: var(--mod-toast-spacing-top-edge-to-divider, var(--spectrum-toast-spacing-top-edge-to-divider));
    margin-block-end: var(--mod-toast-spacing-bottom-edge-to-divider, var(--spectrum-toast-spacing-bottom-edge-to-divider));
    padding-inline-end: var(--mod-toast-spacing-close-button, var(--spectrum-toast-spacing-close-button));
    display: flex;
}

.buttons .spectrum-CloseButton {
    align-self: flex-start;
}

.body {
    flex-wrap: wrap;
    flex: auto;
    align-self: center;
    align-items: center;
    padding-block-start: var(--mod-toast-spacing-block-start, var(--spectrum-toast-spacing-block-start));
    padding-block-end: var(--mod-toast-spacing-block-end, var(--spectrum-toast-spacing-block-end));
    display: flex;
}

.body ::slotted([slot="action"]) {
    margin-inline-start: auto;
    margin-inline-end: var(--mod-toast-spacing-text-and-action-button-to-divider, var(--spectrum-toast-spacing-text-and-action-button-to-divider));
}

.body ::slotted([slot="action"]:dir(rtl)),
:host([dir="rtl"]) .body ::slotted([slot="action"]) {
    margin-inline-end: var(--mod-toast-spacing-text-and-action-button-to-divider, var(--spectrum-toast-spacing-text-and-action-button-to-divider));
}

.body + .buttons {
    border-inline-start-style: solid;
    border-inline-start-width: 1px;
    padding-inline-start: var(--mod-toast-spacing-close-button, var(--spectrum-toast-spacing-close-button));
}
